<link rel="stylesheet" href="../static/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../static/jBox/Skins/Metro/jbox.css" type="text/css">
<link rel="stylesheet" href="../static/dist/css/AdminLTE.min.css" type="text/css">
<link rel="stylesheet" href="../static/css/admin.css" type="text/css">
<link rel="stylesheet" href="../static/plugins/treeTable/jquery.treetable.css" type="text/css">
<link rel="stylesheet" href="../static/plugins/treeTable/jquery.treetable.theme.default.css" type="text/css">
<link rel="stylesheet" href="../static/plugins/datatables/jquery.dataTables.css" type="text/css">
<link rel="stylesheet" href="../static/plugins/daterangepicker/daterangepicker.css" type="text/css">
<link rel="stylesheet" href="../static/plugins/datepicker/datepicker3.css" type="text/css">
<link rel="stylesheet" href="../static/app/goods-keyword/css/bootstrap.min.css" type="text/css" >
<link rel="stylesheet" href="../static/app/goods-keyword/css/jquery.dropdown.css" type="text/css" >
<style>
.ul_tree_display {
	display: none;
}

.tr_tree_display {
	display: none;
}

.table>tbody>tr>td {
	vertical-align: middle;
	font-size: 0.8em;
}

.layui-layer-content p {
	padding: 15px;
}

.dataTables_length {
	margin-top: 10px;
}
</style>
<div class="tabs-panel">
	<div class="row">
		<div class="col-xs-12">
			<div class="box">
				<div class="box-header">
					<label>优惠券类型：</label>
					<select class="depart-input" style="width: 150px" id="search_type" name="search_type">
					<option value="">全部</option>
					<?php 
					if (is_array($GLOBALS['_COUPON_TYPE']) && count($GLOBALS['_COUPON_TYPE']) > 0)foreach ($GLOBALS['_COUPON_TYPE'] as $type=>$type_name){
					?>
					<option value="<?=$type?>"><?=$type_name?></option>
					<?php }?>
					</select>
					<label>优惠券名称：</label><input class="depart-input" name="search_title" id="search_title" type="text" placeholder="">
					&nbsp;
					<button type="button" class="btn btn-primary depart-modal" onclick="table_list_reload()" style="width: 100px;">查询</button>
					&nbsp;
					<button type="button" class="btn btn-warning depart-modal" id="reset_button" style="width: 100px;">重置</button>
					&nbsp;
					<button type="button" class="btn btn-success depart-modal add_coupon" style="width: 100px;">添加优惠券</button>
				</div>
				<div class="box-body">
					<table id="table_list" class="table table-bordered table-hover">
						<thead>
							<tr>
								<th class="">序号</th>
								<th class="">优惠券类型</th>
								<th class="">优惠券名称</th>
								<th class="">重点突出</th>
								<th class="">有效期</th>
								<th class="">发放张数</th>
								<th class="">已领取张数</th>
								<th class="">使用标识</th>
								<th class="">启用</th>
								<th class="">操作</th>
							</tr>
						</thead>
						<tbody>
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
</div>

<div class="modal fade" id="coupon-modal" style="background: rgba(236, 230, 230, 0.3);" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width: 50%;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">活动信息</h4>
            </div>
            <div class="modal-body">
                <form action="/coupon/change-coupon" method="post" name="coupon_form" id="coupon_form">
                    <div class="box-body">
                    	<div class="form-group">
                            <label for="tag_group_id_add"><span class="text-danger" style="font-size:20px;">* </span>优惠券类型</label>
                            <select class="form-control" style="width: 25%" id="type" name="type">
                            <option value="">请选择</option>
                            <?php 
        					if (is_array($GLOBALS['_COUPON_TYPE']) && count($GLOBALS['_COUPON_TYPE']) > 0)foreach ($GLOBALS['_COUPON_TYPE'] as $type=>$type_name){
        					?>
        					<option value="<?=$type?>"><?=$type_name?></option>
        					<?php }?>
                        	</select>
                        </div>
                        <div class="form-group">
                            <label for="tag_group_id_add"><span class="text-danger" style="font-size:20px;">* </span>优惠券名称</label>
                            <input style="width: 50%;" class="form-control" name="title" id="title" placeholder="优惠卷名称" type="text">
                        </div>
                        <div class="form-group">
                            <label for="tag_group_id_add"><span class="text-danger" style="font-size:20px;">* </span>重点突出</label>
                            <input style="width: 50%;" class="form-control" name="highlight" id="highlight" placeholder="重点突出" type="text">
                        </div>
                        <div class="form-group">
                            <label for="tag_group_id_add"><span class="text-danger" style="font-size:20px;">* </span>有效期</label>
                            <input class="form-control depart-input" name="reservationtime" id="reservationtime" type="text" placeholder="" style="width: 270px">
                        </div>
                        <div class="form-group">
                        	<label for="tag_group_id_add"><span class="text-danger" style="font-size:20px;">* </span>使用描述</label>
                        	<textarea style="width: 50%;" class="form-control" name="content" id="content"></textarea>
                        </div>
                        <div class="form-group">
                        	<button type="button" class="btn btn-success depart-modal" id="add_input" style="width: 100px;">添加分类</button>
                            <table class="table table-hover" id="input_table">
                            	<thead>
                                    <tr>
                                        <th>分类名称</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody class="tbody-class">
                                </tbody>
                            </table>
                        </div>
                        <div class="form-group">
                        	<button type="button" class="btn btn-success depart-modal" id="add_input_sku" style="width: 100px;">添加商品</button>
                        	&nbsp;&nbsp;&nbsp;<a style="text-decoration:underline;" href="../static/app/coupon/优惠卷商品导入.xls">模板下载</a>
                        	&nbsp;&nbsp;&nbsp;<a style="text-decoration:underline;" href="javascript:void(0)" class="upload-img-btn">excel导入</a>
                            <table class="table table-hover" id="input_table_sku">
                            	<thead>
                                    <tr>
                                        <th>物料号</th>
                                        <th>商品名称</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody class="tbody-class">
                                </tbody>
                            </table>
                        </div>
                        <div class="form-group">
                            <label for="tag_group_id_add"><span class="text-danger" style="font-size:20px;">* </span>发放张数</label>
                            <input  style="width: 50%;" class="form-control" name="release_number" id="release_number" type="text" placeholder="发放张数">
                        </div>
                        <div class="form-group" id="use_mark_div">
                            <label for="tag_group_id_add"><span class="text-danger">* </span>使用标识</label>
                            <div class="use_mark_class" style="width:50%">
                            	<select style="display:none;" name="use_mark" multiple id="use_mark" placeholder="请选择">
                                	<?php 
                                	if (is_array($GLOBALS['_COUPON_USE_MARK']) && count($GLOBALS['_COUPON_USE_MARK']) > 0)foreach ($GLOBALS['_COUPON_USE_MARK'] as $use_mark=>$use_mark_name){
                                	?>
                                	<option value="<?=$use_mark?>" ><?=$use_mark_name?></option>
                                	<?php }?>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="tag_group_id_add"><span class="text-danger">* </span>状态</label>
                            <select name="use_flg" id="use_flg" style="width: 25%;"  class="form-control">
                            	<option value="1">启用</option>
                            	<option value="0">禁用</option>
                            </select>
                        </div>
                        <input name="coupon_id" type="hidden" id="coupon_id">
                    </div>
                </form>
                <div style="display: none">
                    <form id="upload_form_update" action="/coupon/excel-file-upload" method="post" enctype="multipart/form-data">
                    	<label for="file">Filename:</label>
                    	<input type="file" name="file" id="file" class="upload_file"/> 
                    	<br />
                    	<input type="submit" name="submit" value="Submit" />
                    </form>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <a type="button" class="btn btn-primary ajax_post_tag">提交</a>
            </div>
        </div>
    </div>
</div>
<input name="class_len" id="class_len" value="0" type="hidden"/>
<!-- 固定js -->
<script type="text/javascript" src="/static/plugins/jQuery/jquery-2.2.3.min.js"></script>
<script type="text/javascript" src="/static/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/static/plugins/datatables/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/static/plugins/datatables/dataTables.bootstrap.min.js"></script>
<script type="text/javascript" src="/static/jBox/jquery.jBox-2.3.min.js"></script>
<script type="text/javascript" src="/static/jBox/i18n/jquery.jBox-zh-CN.js"></script>
<script type="text/javascript" src="/static/plugins/treeTable/jquery.treetable.js"></script>
<!-- 时间插件 -->
<script type="text/javascript" src="../static/plugins/moment/moment.min.js"></script>
<script type="text/javascript" src="../static/plugins/daterangepicker/daterangepicker.js"></script>
<script type="text/javascript" src="../static/plugins/datepicker/bootstrap-datepicker.js"></script>
<!-- 搜索下拉框插件 -->
<script type="text/javascript" src="../static/app/goods-keyword/js/jquery.dropdown.js"></script>
<script type="text/javascript" src="../static/app/goods-keyword/js/mock.js"></script>
<!-- 文件上传插件 -->
<script type="text/javascript" src="../static/app/activity-message/ajaxfileupload.js"></script>
<!-- 自定义js -->
<script type="text/javascript" src="/static/app/global.js?version=<?=Yii::$app->params['version']?>"></script>
<script type="text/javascript" src="/static/app/coupon/list.js?version=<?=Yii::$app->params['version']?>"></script>
<script>
	var category = <?=(is_array($GLOBALS['_GOODS_GENRE_TYPE']) && count($GLOBALS['_GOODS_GENRE_TYPE']) > 0 ? json_encode($GLOBALS['_GOODS_GENRE_TYPE']) : '')?>;
	var use_mark = <?=(is_array($GLOBALS['_COUPON_USE_MARK']) && count($GLOBALS['_COUPON_USE_MARK']) > 0 ? json_encode($GLOBALS['_COUPON_USE_MARK']) : '') ?>;
</script>